@charset "utf-8";

@import '../variable';

/**
 * 
 * @Input.css
 * @author zhangxinxu 
 * @create 15-06-16
 * @edit   17-06-13
 */

/*disabled X for IE */
input:not([type=search])::-ms-clear {
  display: none;
}
/* reset [type=search] ui */
[type=search] {
  -webkit-appearance: none;
   box-sizing: content-box;
}
[type=search]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-right: -2px;
  background: $silver url() no-repeat center;
  background-size: 20px 20px;
  -webkit-transition: background-color .15s;
  transition: background-color .15s;
  cursor: pointer;
}
[type=search]::-webkit-search-cancel-button:hover {
  background-color: $dark;
}
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px $white inset;
    background-color: transparent;
}

input[disabled], input[readonly] {
  cursor: default;
}

input.ui-input,
.ui-input > input {
  height: 20px;
  line-height: 20px;
  padding: 9px 8px; 
  border: 1px solid $borderNormal;
  border-radius: 4px;
  background-color: $white;
  font-size: 14px;
  outline: none;
  color: $dark;
  -webkit-transition: border-color .15s, background-color .15s;
  transition: border-color .15s, background-color .15s;
}

.ui-input:hover,
.ui-input:hover > input {
  border-color: $borderHover;
}
.ui-input:focus,
.ui-input > input:focus {
  border-color: $borderFocus;
}

span.ui-input {
  display: inline-block;
}

div.ui-input > input {
  width: 100%;
  height: 40px;
  -ms-box-sizing: border-box;
  box-sizing: border-box;   
}

/* input with count */
.ui-input-x {
  position: relative;
  padding: 0 56px 0 3px;
  border-radius: $borderRadius;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
  overflow: hidden;
}
.ui-input-x > input {
  display: block;
  width: 100%;
  height: 20px;
  line-height: 20px;
  padding: 9px 0 9px;
  border: 0 none;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  right: -6px;
  color: $dark;
  font-size: 14px;
  outline: none;
  background: none;
  background-clip: content-box;
  position: relative;
  z-index: 1;
}
.ui-input-x > .ui-input {
  position: absolute;
  border: 1px solid $borderNormal;
  border-radius: $borderRadius;
  background-color: $white;
  top: 0; bottom: 0; left: 0; right: 0;
  -webkit-transition: border-color .15s, background-color .15s;
  transition: border-color .15s, background-color .15s;
}
.ui-input-count {
  line-height: 38px;
  padding: 0 2px;
  background-color: $white;
  color: $gray;
  font-size: 12px;
  white-space: nowrap;
  position: absolute;
  right: 8px; top: 1px;
  z-index: 1;
}
.ui-input-x:hover > .ui-input {
  border-color: $borderHover;
}
/* 注意相邻位置，如果文本域前后位置发生变化，表单验证组件Validate.js 中 getTarget那里逻辑也要变化 */
.ui-input-x > input:focus ~ .ui-input {
  border-color: $borderFocus;
}
.ui-input-x .ui-placeholder {
  padding: 9px 7px;
  z-index: 1;
}

/* type=[search] with icon */
div.ui-search-input,
span.ui-search-input {
  position: relative;
}
.ui-search-input > input {
  padding-left: 40px;
}

.ui-icon-search {
  position: absolute;
  left: 3px; top: 1px;
  width: 20px;
  height: 20px;
  border: solid $white;
  border-width: 9px 8px;  
  -webkit-transition: background-color .2s;
  transition: background-color .2s;
  text-indent: -9em;
  cursor: pointer;
  overflow: hidden;
}
.ui-search-input:hover .ui-icon-search {
  background-color: $borderHover; 
}
.ui-search-input > input:focus ~ .ui-icon-search {
  background-color: $borderFocus;
}

.ui-search-input > .error ~ .ui-icon-search,
.ui-search-input > .error:focus ~ .ui-icon-search {
  background-color: $red;
}


/* IE使用png图片, 虽然IE9+支持SVG，但是貌似渲染太慢，会暴露色块 */
.ui-icon-search, 
.ui-search-right > .ui-icon-search:after {
  background: $silver url() no-repeat;
}
/* IE13+和其他现代浏览器使用SVG */
@supports (display:none) {
  .ui-icon-search, 
  .ui-search-right > .ui-icon-search:after {
    background-image: url();
    background-size: 20px 20px;
  }
}

/* type=[search] icon right */
.ui-search-right:after {
  display: inline-block;
  content: '';
  height: 25px;
}
div.ui-search-right {
  -ms-box-sizing: border-box;
  box-sizing: border-box;
  padding-right: 40px;
  overflow: hidden;
}
.ui-search-right > input {
  float: left;
  padding-left: 8px;
  padding-right: 0;
  border-width: 1px 0 1px 1px;
  border-color: transparent!important;
  background: none;
  position: relative;
  z-index: 1;
}
.ui-search-right > .ui-icon-search {
  position: static;
  float: left;
  margin-top: 1px;
  margin-right: 1px;
}
div.ui-search-right > .ui-icon-search {
  margin-right: -40px;
}
.ui-search-right > .ui-icon-search:before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  border: 1px solid $borderNormal;
  background-color: #fff;
  border-radius: $borderRadius;
  -webkit-transition: border-color .15s;
  transition: border-color .15s;
}
.ui-search-right > .ui-icon-search:after {
  content: '';
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px;
  -webkit-transition: background-color .2s;
  transition: background-color .2s;
}
.ui-search-right:hover .ui-icon-search:before {
  border-color: $borderHover;
}
.ui-search-right:hover .ui-icon-search:after {
  background-color: $borderHover;
}
.ui-search-right > input:focus ~ .ui-icon-search:before {
  border-color: $borderFocus;
}
.ui-search-right > input:focus ~ .ui-icon-search:after {
  background-color: $borderFocus;
}
.ui-search-right .ui-placeholder {
  z-index: 1;
}
span.ui-search-right > .ui-placeholder {
  margin-left: 0!important;
  left: 0; *left: 9px;
}

/* disabled */
input.ui-input[disabled],
.ui-input > input[disabled] {
  background-color: $light;
}
.ui-input[disabled]:hover,
.ui-input > input[disabled]:hover,
.ui-input[readonly]:hover,
.ui-input > input[readonly]:hover,
.ui-input[readonly]:focus,
.ui-input > input[readonly]:focus {
  border-color: $borderNormal;
}

/* error */
.ui-input.error,
.ui-input > .error {
  border-color: $red!important;
}
